<%@ CodePage = 65001 %>

<!--#include file="includes/database.asp" -->
<!--#include file="includes/global_varaiable.asp" -->
<!--#include file="suatchieu_info.asp" -->

<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.addHeader "cache-control", "no-cache"
Response.addHeader "cache-control", "no-store"
Response.CacheControl = "no-cache"

nStartRec = 0
nStopRec = 0
nTotalRecs = 0
nRecCount = 0
nRecActual = 0
sDbWhereMaster = ""
sDbWhereDetail = ""
sSrchAdvanced = ""
psearch = ""
psearchtype = ""
sSrchBasic = ""
sSrchWhere = ""
sDbWhere = ""
sOrderBy = ""
sSqlMaster = ""
sDeleteConfirmMsg = "Do you want to delete the selected records?"
nDisplayRecs = 20
nRecRange = 10

' Handle Reset Command
ResetCmd()

' Build Filter condition
sDbWhere = ""
If sDbWhereDetail <> "" Then
	sDbWhere = sDbWhere & "(" & sDbWhereDetail & ") AND "
End If
If sSrchWhere <> "" Then
	sDbWhere = sDbWhere & "(" & sSrchWhere & ") AND "
End If
If Len(sDbWhere) > 5 Then
	sDbWhere = Mid(sDbWhere, 1, Len(sDbWhere)-5) ' Trim rightmost AND
End If

' Set up SQL
sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sDbWhere, sOrderBy)

'Response.Write sSql ' Uncomment to show SQL for debugging
%>
<!--#include file="header.asp"-->
<script type="text/javascript">
<!--
EW_LookupFn = "ewlookup.asp"; // ewlookup file name
EW_AddOptFn = "ewaddopt.asp"; // ewaddopt.asp file name
EW_MultiPagePage = "Page"; // multi-page Page Text
EW_MultiPageOf = "of"; // multi-page Of Text
//-->
</script>
<script type="text/javascript" src="ew.js"></script>
<script type="text/javascript">
<!--
function EW_selectKey(elem) {
	var f = elem.form;	
	if (!f.key_d) return;
	if (f.key_d[0]) {
		for (var i=0; i<f.key_d.length; i++)
			f.key_d[i].checked = elem.checked;	
	} else {
		f.key_d.checked = elem.checked;	
	}
	ew_clickall(elem);
}
function EW_selected(elem) {
	var f = elem.form;	
	if (!f.key_d) return false;
	if (f.key_d[0]) {
		for (var i=0; i<f.key_d.length; i++)
			if (f.key_d[i].checked) return true;
	} else {
		return f.key_d.checked;
	}
	return false;
}
//-->
</script>
<%

' Set up Record Set
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open sSql, adoCon, 1, 2
nTotalRecs = rs.RecordCount
If nDisplayRecs <= 0 Then ' Display All Records
	nDisplayRecs = nTotalRecs
End If
nStartRec = 1
SetUpStartRec() ' Set Up Start Record Position
%>
<p><span class="aspmaker">TABLE: FS GLX Xuatchieu
</span></p>
<table class="ewListAdd">
	<tr>
		<td><span class="aspmaker"><a href="suatchieu_add.asp">Add</a></span></td>
	</tr>
</table>
<p>
<%
If Session(ewSessionMessage) <> "" Then
%>
<p><span class="ewmsg"><%= Session(ewSessionMessage) %></span></p>
<%
	Session(ewSessionMessage) = "" ' Clear message
End If
%>
<% If nTotalRecs > 0 Then %>
<form method="post">
<table id="ewlistmain" class="ewTable">
	<!-- Table header -->
	<tr class="ewTableHeader">
		<td valign="top"><span>
	<a href="FS_GLX_Xuatchieulist.asp?order=<%= Server.URLEncode("RapID") %>">Rap ID<% If Session(ewSessionTblSort & "_x_RapID") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session(ewSessionTblSort & "_x_RapID") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
		</span></td>
		<td valign="top"><span>
	<a href="FS_GLX_Xuatchieulist.asp?order=<%= Server.URLEncode("GiochieuID") %>">Giochieu ID<% If Session(ewSessionTblSort & "_x_GiochieuID") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session(ewSessionTblSort & "_x_GiochieuID") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
		</span></td>
		<td valign="top"><span>
	<a href="FS_GLX_Xuatchieulist.asp?order=<%= Server.URLEncode("FilmId") %>">Film Id<% If Session(ewSessionTblSort & "_x_FilmId") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session(ewSessionTblSort & "_x_FilmId") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
		</span></td>
		<td valign="top"><span>
	<a href="FS_GLX_Xuatchieulist.asp?order=<%= Server.URLEncode("Mota") %>">Mota&nbsp;(*)<% If Session(ewSessionTblSort & "_x_Mota") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session(ewSessionTblSort & "_x_Mota") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
		</span></td>
		<td valign="top"><span>
	<a href="FS_GLX_Xuatchieulist.asp?order=<%= Server.URLEncode("Gia") %>">Gia<% If Session(ewSessionTblSort & "_x_Gia") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session(ewSessionTblSort & "_x_Gia") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
		</span></td>
		<td valign="top"><span>
	<a href="FS_GLX_Xuatchieulist.asp?order=<%= Server.URLEncode("Ngaychieu") %>">Ngaychieu<% If Session(ewSessionTblSort & "_x_Ngaychieu") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session(ewSessionTblSort & "_x_Ngaychieu") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
		</span></td>
<td><input type="checkbox" class="aspmaker" onClick="EW_selectKey(this);"></td>
	</tr>
<%

' Avoid starting record > total records
If CLng(nStartRec) > CLng(nTotalRecs) Then
	nStartRec = nTotalRecs
End If

' Set the last record to display
nStopRec = nStartRec + nDisplayRecs - 1

' Move to first record directly for performance reason
nRecCount = nStartRec - 1
If Not rs.Eof Then
	rs.MoveFirst
	rs.Move nStartRec - 1
End If
nRecActual = 0
Do While (Not rs.Eof) And (nRecCount < nStopRec)
	nRecCount = nRecCount + 1
	If CLng(nRecCount) >= CLng(nStartRec) Then
		nRecActual = nRecActual + 1

	' Set row color
	sItemRowClass = " class=""ewTableRow"""
	sListTrJs = " onmouseover='ew_mouseover(this);' onmouseout='ew_mouseout(this);' onclick='ew_click(this);'"

	' Display alternate color for rows
	If nRecCount Mod 2 <> 1 Then
		sItemRowClass = " class=""ewTableAltRow"""
	End If
	x_RapID = rs("RoomID")
	x_GiochieuID = rs("SessionID")
	x_FilmId = rs("FilmId")
	x_Mota = rs("Description")
	x_Gia = rs("Price")
	x_Ngaychieu = rs("DayShow")
%>
	<!-- Table body -->
	<tr<%=sItemRowClass%><%=sListTrJs%>>
		<!-- RapID -->
		<td><span>
<%
If Not IsNull(x_RapID) Then
	sSqlWrk = "SELECT [RoomName] FROM [PHONGCHIEU]"
	sTmp = x_RapID
	sSqlWrk = sSqlWrk & " WHERE [RoomID] = '" & AdjustSql(sTmp) & "'"
	Set rswrk = adoCon.Execute(sSqlWrk)
	If Not rswrk.Eof Then
		sTmp = rswrk("RoomName")
	End If
	rswrk.Close
	Set rswrk = Nothing
Else
	sTmp = Null
End If
ox_RapID = x_RapID ' Backup Original Value
x_RapID = sTmp
%>
<% Response.Write x_RapID %>
<% x_RapID = ox_RapID ' Restore Original Value %>
</span></td>
		<!-- GiochieuID -->
		<td><span>
<%
If Not IsNull(x_GiochieuID) Then
	sSqlWrk = "SELECT [Description] FROM [GIOCHIEU]"
	sTmp = x_GiochieuID
	sSqlWrk = sSqlWrk & " WHERE [SessionID] = " & AdjustSql(sTmp) & ""
	Set rswrk = adoCon.Execute(sSqlWrk)
	If Not rswrk.Eof Then
		sTmp = rswrk("Description")
	End If
	rswrk.Close
	Set rswrk = Nothing
Else
	sTmp = Null
End If
ox_GiochieuID = x_GiochieuID ' Backup Original Value
x_GiochieuID = sTmp
%>
<% Response.Write x_GiochieuID %>
<% x_GiochieuID = ox_GiochieuID ' Restore Original Value %>
</span></td>
		<!-- FilmId -->
		<td><span>
<%
If Not IsNull(x_FilmId) Then
	sSqlWrk = "SELECT [Title] FROM [CHITIETPHIM]"
	sTmp = x_FilmId
	sSqlWrk = sSqlWrk & " WHERE [FilmID] = " & AdjustSql(sTmp) & ""
	sSqlWrk = sSqlWrk & " ORDER BY [DateCreated] Desc"
	Set rswrk = adoCon.Execute(sSqlWrk)
	If Not rswrk.Eof Then
		sTmp = rswrk("Title")
	End If
	rswrk.Close
	Set rswrk = Nothing
Else
	sTmp = Null
End If
ox_FilmId = x_FilmId ' Backup Original Value
x_FilmId = sTmp
%>
<% Response.Write x_FilmId %>
<% x_FilmId = ox_FilmId ' Restore Original Value %>
</span></td>
		<!-- Mota -->
		<td><span>
<%= Replace(x_Mota&"", vbLf, "<br>") %>
</span></td>
		<!-- Gia -->
		<td><span>
<% Response.Write x_Gia %>
</span></td>
		<!-- Ngaychieu -->
		<td><span>
<% If IsDate(x_Ngaychieu) Then Response.Write x_Ngaychieu Else Response.Write x_Ngaychieu End If %>
</span></td>
<td><span class="aspmaker"><input type="checkbox" name="key_d" value="<%= x_RapID&","&x_GiochieuID&","&x_Ngaychieu %>" class="aspmaker" onclick='ew_clickmultidelete(this);'>Delete</span></td>
	</tr>
<%
	End If
	rs.MoveNext
Loop
%>
</table>
<% If nRecActual > 0 Then %>
<p>
<input type="button" name="btndelete" value="DELETE SELECTED" onClick="if (!EW_selected(this)) alert('No records selected'); else if (ew_confirm('<%=sDeleteConfirmMsg%>')) {this.form.action='FS_GLX_Xuatchieudelete.asp';this.form.encoding='application/x-www-form-urlencoded';this.form.submit();}">
<p>
<% End If %>
</form>
<% End If %>
<%

' Close recordset and adoConection
rs.Close
Set rs = Nothing
adoCon.Close
Set adoCon = Nothing
%>
<form action="FS_GLX_Xuatchieulist.asp" name="ewpagerform" id="ewpagerform">
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td nowrap>
<%
If nTotalRecs > 0 Then
	rsEof = (nTotalRecs < (nStartRec + nDisplayRecs))
	PrevStart = nStartRec - nDisplayRecs
	If PrevStart < 1 Then PrevStart = 1
	NextStart = nStartRec + nDisplayRecs
	If NextStart > nTotalRecs Then NextStart = nStartRec
	LastStart = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1
	%>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="aspmaker">Page&nbsp;</span></td>
<!--first page button-->
	<% If CLng(nStartRec)=1 Then %>
	<td><img src="images/firstdisab.gif" alt="First" width="16" height="16" border="0"></td>
	<% Else %>
	<td><a href="FS_GLX_Xuatchieulist.asp?start=1"><img src="images/first.gif" alt="First" width="16" height="16" border="0"></a></td>
	<% End If %>
<!--previous page button-->
	<% If CLng(PrevStart) = CLng(nStartRec) Then %>
	<td><img src="images/prevdisab.gif" alt="Previous" width="16" height="16" border="0"></td>
	<% Else %>
	<td><a href="FS_GLX_Xuatchieulist.asp?start=<%=PrevStart%>"><img src="images/prev.gif" alt="Previous" width="16" height="16" border="0"></a></td>
	<% End If %>
<!--current page number-->
	<td><input type="text" name="pageno" value="<%=(nStartRec-1)\nDisplayRecs+1%>" size="4"></td>
<!--next page button-->
	<% If CLng(NextStart) = CLng(nStartRec) Then %>
	<td><img src="images/nextdisab.gif" alt="Next" width="16" height="16" border="0"></td>
	<% Else %>
	<td><a href="FS_GLX_Xuatchieulist.asp?start=<%=NextStart%>"><img src="images/next.gif" alt="Next" width="16" height="16" border="0"></a></td>
	<% End If %>
<!--last page button-->
	<% If CLng(LastStart) = CLng(nStartRec) Then %>
	<td><img src="images/lastdisab.gif" alt="Last" width="16" height="16" border="0"></td>
	<% Else %>
	<td><a href="FS_GLX_Xuatchieulist.asp?start=<%=LastStart%>"><img src="images/last.gif" alt="Last" width="16" height="16" border="0"></a></td>
	<% End If %>
	<td><span class="aspmaker">&nbsp;of <%=(nTotalRecs-1)\nDisplayRecs+1%></span></td>
	</tr></table>
	<% If CLng(nStartRec) > CLng(nTotalRecs) Then nStartRec = nTotalRecs
	nStopRec = nStartRec + nDisplayRecs - 1
	nRecCount = nTotalRecs - 1
	If rsEOF Then nRecCount = nTotalRecs
	If nStopRec > nRecCount Then nStopRec = nRecCount %>
	<span class="aspmaker">Records <%= nStartRec %> to <%= nStopRec %> of <%= nTotalRecs %></span>
<% Else %>
	<% If sSrchWhere = "0=101" Then %>
	<span class="aspmaker"></span>
	<% Else %>
	<span class="aspmaker">No records found</span>
	<% End If %>
<% End If %>
		</td>
	</tr>
</table>
</form>
<!--#include file="footer.asp"-->
<%

'-------------------------------------------------------------------------------
' Function BasicSearchSQL
' - Build WHERE clause for a keyword

Function BasicSearchSQL(Keyword)
	Dim sKeyword
	sKeyword = AdjustSql(Keyword)
	BasicSearchSQL = ""
	BasicSearchSQL = BasicSearchSQL & "[Mota] LIKE '%" & sKeyword & "%' OR "
	If Right(BasicSearchSQL, 4) = " OR " Then BasicSearchSQL = Left(BasicSearchSQL, Len(BasicSearchSQL)-4)
End Function

'-------------------------------------------------------------------------------
' Function SetUpBasicSearch
' - Set up Basic Search parameter based on form elements pSearch & pSearchType
' - Variables setup: sSrchBasic

Sub SetUpBasicSearch()
	Dim arKeyword, sKeyword
	psearch = Request.QueryString(ewTblBasicSrch)
	psearchtype = Request.QueryString(ewTblBasicSrchType)
	If psearch <> "" Then
		If psearchtype <> "" Then
			While InStr(psearch, "  ") > 0
				sSearch = Replace(psearch, "  ", " ")
			Wend
			arKeyword = Split(Trim(psearch), " ")
			For Each sKeyword In arKeyword
				sSrchBasic = sSrchBasic & "(" & BasicSearchSQL(sKeyword) & ") " & psearchtype & " "
			Next
		Else
			sSrchBasic = BasicSearchSQL(psearch)
		End If
	End If
	If Right(sSrchBasic, 4) = " OR " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-4)
	If Right(sSrchBasic, 5) = " AND " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-5)
	If psearch <> "" then
		Session(ewSessionTblBasicSrch) = psearch
		Session(ewSessionTblBasicSrchType) = psearchtype
	End If
End Sub

'-------------------------------------------------------------------------------
' Function ResetSearch
' - Clear all search parameters
'

Sub ResetSearch()

	' Clear search where
	sSrchWhere = ""
	Session(ewSessionTblSearchWhere) = sSrchWhere

	' Clear advanced search parameters
	Session(ewSessionTblAdvSrch & "_x_RapID") = ""
	Session(ewSessionTblAdvSrch & "_x_GiochieuID") = ""
	Session(ewSessionTblAdvSrch & "_x_FilmId") = ""
	Session(ewSessionTblAdvSrch & "_x_Mota") = ""
	Session(ewSessionTblAdvSrch & "_x_Gia") = ""
	Session(ewSessionTblAdvSrch & "_x_Ngaychieu") = ""
	Session(ewSessionTblBasicSrch) = ""
	Session(ewSessionTblBasicSrchType) = ""
End Sub

'-------------------------------------------------------------------------------
' Function RestoreSearch
' - Restore all search parameters
'

Sub RestoreSearch()

	' Restore advanced search settings
	x_RapID = Session(ewSessionTblAdvSrch & "_x_RapID")
	x_GiochieuID = Session(ewSessionTblAdvSrch & "_x_GiochieuID")
	x_FilmId = Session(ewSessionTblAdvSrch & "_x_FilmId")
	x_Mota = Session(ewSessionTblAdvSrch & "_x_Mota")
	x_Gia = Session(ewSessionTblAdvSrch & "_x_Gia")
	x_Ngaychieu = Session(ewSessionTblAdvSrch & "_x_Ngaychieu")
	psearch = Session(ewSessionTblBasicSrch)
	psearchtype = Session(ewSessionTblBasicSrchType)
End Sub

'-------------------------------------------------------------------------------
' Function SetUpSortOrder
' - Set up Sort parameters based on Sort Links clicked
' - Variables setup: sOrderBy, Session(TblOrderBy), Session(Tbl_Field_Sort)

Sub SetUpSortOrder()
	Dim sOrder, sSortField, sLastSort, sThisSort
	Dim bCtrl

	' Check for an Order parameter
	If Request.QueryString("order").Count > 0 Then
		sOrder = Request.QueryString("order")

		' Field [RapID]
		If sOrder = "RapID" Then
			sSortField = "[RapID]"
			sLastSort = Session(ewSessionTblSort & "_x_RapID")
			If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
			Session(ewSessionTblSort & "_x_RapID") = sThisSort
		Else
			If Session(ewSessionTblSort & "_x_RapID") <> "" Then Session(ewSessionTblSort & "_x_RapID") = ""
		End If

		' Field [GiochieuID]
		If sOrder = "GiochieuID" Then
			sSortField = "[GiochieuID]"
			sLastSort = Session(ewSessionTblSort & "_x_GiochieuID")
			If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
			Session(ewSessionTblSort & "_x_GiochieuID") = sThisSort
		Else
			If Session(ewSessionTblSort & "_x_GiochieuID") <> "" Then Session(ewSessionTblSort & "_x_GiochieuID") = ""
		End If

		' Field [FilmId]
		If sOrder = "FilmId" Then
			sSortField = "[FilmId]"
			sLastSort = Session(ewSessionTblSort & "_x_FilmId")
			If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
			Session(ewSessionTblSort & "_x_FilmId") = sThisSort
		Else
			If Session(ewSessionTblSort & "_x_FilmId") <> "" Then Session(ewSessionTblSort & "_x_FilmId") = ""
		End If

		' Field [Mota]
		If sOrder = "Mota" Then
			sSortField = "[Mota]"
			sLastSort = Session(ewSessionTblSort & "_x_Mota")
			If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
			Session(ewSessionTblSort & "_x_Mota") = sThisSort
		Else
			If Session(ewSessionTblSort & "_x_Mota") <> "" Then Session(ewSessionTblSort & "_x_Mota") = ""
		End If

		' Field [Gia]
		If sOrder = "Gia" Then
			sSortField = "[Gia]"
			sLastSort = Session(ewSessionTblSort & "_x_Gia")
			If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
			Session(ewSessionTblSort & "_x_Gia") = sThisSort
		Else
			If Session(ewSessionTblSort & "_x_Gia") <> "" Then Session(ewSessionTblSort & "_x_Gia") = ""
		End If

		' Field [Ngaychieu]
		If sOrder = "Ngaychieu" Then
			sSortField = "[Ngaychieu]"
			sLastSort = Session(ewSessionTblSort & "_x_Ngaychieu")
			If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
			Session(ewSessionTblSort & "_x_Ngaychieu") = sThisSort
		Else
			If Session(ewSessionTblSort & "_x_Ngaychieu") <> "" Then Session(ewSessionTblSort & "_x_Ngaychieu") = ""
		End If
		Session(ewSessionTblOrderBy) = sSortField & " " & sThisSort
		Session(ewSessionTblStartRec) = 1
	End If
	sOrderBy = Session(ewSessionTblOrderBy)
	If sOrderBy = "" Then
		sOrderBy = ewSqlOrderBy
		Session(ewSessionTblOrderBy) = sOrderBy
	End If
End Sub

'-------------------------------------------------------------------------------
' Function SetUpStartRec
' - Set up Starting Record parameters based on Pager Navigation
' - Variables setup: nStartRec

Sub SetUpStartRec()
	Dim nPageNo

	' Check for a START parameter
	If Request.QueryString(ewTblStartRec).Count > 0 Then
		nStartRec = Request.QueryString(ewTblStartRec)
		Session(ewSessionTblStartRec) = nStartRec
	ElseIf Request.QueryString("pageno").Count > 0 Then
		nPageNo = Request.QueryString("pageno")
		If IsNumeric(nPageNo) Then
			nStartRec = (nPageNo-1)*nDisplayRecs+1
			If nStartRec <= 0 Then
				nStartRec = 1
			ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then
				nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1
			End If
			Session(ewSessionTblStartRec) = nStartRec
		Else
			nStartRec = Session(ewSessionTblStartRec)
			If Not IsNumeric(nStartRec) Or nStartRec = "" Then
				nStartRec = 1 ' Reset start record counter
				Session(ewSessionTblStartRec) = nStartRec
			End If
		End If
	Else
		nStartRec = Session(ewSessionTblStartRec)
		If Not IsNumeric(nStartRec) Or nStartRec = "" Then
			nStartRec = 1 'Reset start record counter
			Session(ewSessionTblStartRec) = nStartRec
		End If
	End If
End Sub

'-------------------------------------------------------------------------------
' Function ResetCmd
' - Clear list page parameters
' - RESET: reset search parameters
' - RESETALL: reset search & master/detail parameters
' - RESETSORT: reset sort parameters

Sub ResetCmd()
	Dim sCmd

	' Get Reset Cmd
	If Request.QueryString("cmd").Count > 0 Then
		sCmd = Request.QueryString("cmd")

		' Reset Search Criteria
		If LCase(sCmd) = "reset" Then
			Call ResetSearch()

		' Reset Search Criteria & Session Keys
		ElseIf LCase(sCmd) = "resetall" Then
			Call ResetSearch()

		' Reset Sort Criteria
		ElseIf LCase(sCmd) = "resetsort" Then
			sOrderBy = ""
			Session(ewSessionTblOrderBy) = sOrderBy
			If Session(ewSessionTblSort & "_x_RapID") <> "" Then Session(ewSessionTblSort & "_x_RapID") = ""
			If Session(ewSessionTblSort & "_x_GiochieuID") <> "" Then Session(ewSessionTblSort & "_x_GiochieuID") = ""
			If Session(ewSessionTblSort & "_x_FilmId") <> "" Then Session(ewSessionTblSort & "_x_FilmId") = ""
			If Session(ewSessionTblSort & "_x_Mota") <> "" Then Session(ewSessionTblSort & "_x_Mota") = ""
			If Session(ewSessionTblSort & "_x_Gia") <> "" Then Session(ewSessionTblSort & "_x_Gia") = ""
			If Session(ewSessionTblSort & "_x_Ngaychieu") <> "" Then Session(ewSessionTblSort & "_x_Ngaychieu") = ""
		End If

		' Reset Start Position (Reset Command)
		nStartRec = 1
		Session(ewSessionTblStartRec) = nStartRec
	End If
End Sub
%>
